package com.example.baselibs;

import android.app.Application;
import android.content.Context;


import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.Utils;
import com.example.baselibs.utils.NotificationUtils;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class BaseApplication extends Application {
    public static Context context;
    private static ExecutorService threadpool= Executors.newFixedThreadPool(3);
    @Override
    public void onCreate() {
        super.onCreate();
        context=getApplicationContext();
        //初始化Notification
        NotificationUtils.setNotificationChannel(this);
        Utils.init(this);
        //初始化路由
        initARouter();
        //bugly初始化
        //工具类库的初始化
        //初始化Timber日志库
        //OK日志打印
    }

    /**
     * 初始化路由
     */
    private void initARouter() {
        ARouter.openLog();
        ARouter.openDebug();
        ARouter.init(this);
    }

    public static Context getContext(){
        return context;
    }

    /**
     * 获取全局线程池
     * @return
     */
    public static ExecutorService getThreadpool(){
        return threadpool;
    }
}
